package com.chinaunicom.behavior.iterator;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/8/16 15:58
 * Description:
 */
public class Client {
    public static void main(String[] args) {

        BookShelf bookShelf = new BookShelf();
        bookShelf.appendBook(new Book("Around the World in 80 Days"));
        bookShelf.appendBook(new Book("Bible"));
        bookShelf.appendBook(new Book("Cinderella"));
        bookShelf.appendBook(new Book("Daddy-Long-Legs"));
        
        // 获取迭代器
        Iterator iterator = bookShelf.iterator();
        while(iterator.hasNext()){
            Book next = (Book) iterator.next();
            System.out.println(next.getName());
        }
    }
}
